﻿@{
    // SINGLE ARTICLE VIEW
    // @TODO IMPLEMENT COMMENTS management in AJAX
}
<h3 class="orange" >@PageData["Article"].title</h3>
<p style="font-size:9px">@PageData["Article"].creationDate.ToString("yyyy/d/M")</p>
<p style="font-size:9px">@PageData["Article"].DisplayName</p>
<p>@PageData["AdminOption"]</p>
<p>@(new HtmlString(PageData["Article"].summary))</p>
<p>@(new HtmlString(PageData["Article"].content))</p>
<p>@PageData["AdminOption"]</p>
<p>@LinkShare.GetHtml(Page.Article.title,null,null,"#WebMatrix #Razor")</p>
@* IF COMMENT DISPLAY ENABLE  *@
@if(PageData["Article"].ShowComments==1){
    // show comments section title
    <h3>Comments</h3>
    <h2>&nbsp;</h2>
    // IF NO COMMENT
    if(PageData["Comments"].Count<=0){
        <text>No comment yet, </text>
        // IF COMMENTING ENABLED
        if(PageData["Article"].enableComments == 1){
            <text>please add one</text>
        }
    
      <h2>&nbsp;</h2>
    }else{
        foreach(var Comment in PageData["Comments"]){
            <div class="comment" style="font-size:12px">
            <div style="font-weight:bold">@Comment.title</div> 
            <div ><span>@Comment.creationDate</span> 
            <span title="@Comment.WebSite">@Comment.author</span></div>
            <div>" @Comment.message "</div>
            </div>
        }
    }
    @* IF COMMENTING ENABLED *@
    if(!String.IsNullOrEmpty(PageData["successMessage"]) && IsPost){
        <div class="green">@PageData["successMessage"]</div>
        <a name="CommentForm"></a>
    }else{
        if(PageData["Article"].enableComments == 1){
            // SHOW COMMENT FORM
            <div class="error">@PageData["errorMessage"]</div>
            
            <a name="CommentForm"></a>
            <form action="@Href("~/Actions/Public/ShowArticle/"+PageData["Article"].id+"#CommentForm")" method="POST" class="CommentForm">
                <fieldset style="border-color:#EEEEEE;border-style:dotted;">
                    <legend>Add a new comment</legend>
                    <table style="font-size:9px">
                        <tbody>
                            <tr>
                                <td>
                                    Name* : 
                                </td>
                                <td >
                                    @Html.TextBox("name",Request.Form["name"])
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Email* : 
                                </td>
                                <td>
                                    @Html.TextBox("email",Request.Form["email"])
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    WebSite : 
                                </td>
                                <td>
                                    @Html.TextBox("website",Request.Form["email"])
                                </td>
                            </tr>
                            <tr>
                            <tr>
                                <td>
                                    Tilte* : 
                                </td>
                                <td>
                                    @Html.TextBox("commentTitle",Request.Form["commentTitle"])
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Comment* : 
                                </td>
                                <td>
                                    @Html.TextArea("commentBody",
                                        Request.Form["commentBody"],new{cols="42",rows="5",style="font-size:11px"})
                                </td>
                            </tr>
                            <tr>
                                <td>
                            @Html.Hidden("ArticleId",PageData["Article"].id)
                            @*AntiForgery.GetHtml()*@
                                </td>
                                <td>
                                    <!-- implement captcha -->
                                </td>
                            </tr>
                            <tr>
                                <td>
                            
                                </td>
                                <td>
                                    @Html.TextBox("Submit","Submit",new{type="Submit", style="font-size:9px"})
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
            </form>
        }
    }
}